<?php

	include "conn.php";
	
	function query($pdotest, $sql) {
	    $stmt = $pdotest->prepare($sql);
	    $stmt->execute();
	    $data = array();
	        foreach($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
	            $t = array();
	            foreach($row as $value) {
	                array_push($t, $value);
	            }
	            array_push($data, $t);
	        }
	    return json_encode(array("user_list"=>$data), JSON_UNESCAPED_UNICODE);
	}
	
	echo query($pdotest, "select * from user");

?>